using System;
using System.Collections.Generic;
using System.Text;
using System.Net;

using EquityXOI;

namespace DailyTestConsole
{
    public class TestEquityXOILogin
    {
        private XOIVistor vistor = XOIVistor.GetInstance();

        public void TestTestLogin()
        {
            if (vistor.TestLogin())
            {
                Console.WriteLine("login success");
            }
            else
            {
                Console.WriteLine("login failed");
            }
        }

        public void GetUrl(int i)
        {
            string url1 = "http://equitydata.xoi.morningstar.com/DataOutput.aspx?package=EquityData&Content=CompanyInfo&Id=0C00000BDL&IdType=EquityCompanyId";
            string url2 = "http://equitydata.xoi.morningstar.com/DataOutput.aspx?package=EquityData&Content=CompanyInfo&Id=0C000006WQ&IdType=EquityCompanyId";
            HttpWebResponse webRes = null;

            if (i == 1)
            {
                webRes = vistor.GetUrlResponse(url1);
            }
            else
            {
                webRes = vistor.GetUrlResponse(url2);
            }

            if (webRes != null)
            {
                Console.WriteLine("get Response");
            }
            else
            {
                Console.WriteLine("get Response failed");
            }
        }
    }
}
